CREATE TABLE [dbo].[tb_Normativas]
(
[IdNormativa] [int] NOT NULL IDENTITY(1, 1),
[Anio] [int] NOT NULL,
[Numero] [int] NOT NULL,
[Normativa] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IdNormativaTipo] [int] NULL,
[IdNormativaAmbito] [int] NULL,
[IdOrganizacionEmisora] [int] NULL,
[Dispone] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FechaNormativa] [datetime] NULL,
[IdSubOrganizacionAutora] [int] NULL,
[URLImagen] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[URLNormativa] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NTUser] [int] NULL CONSTRAINT [DF_tb_Normativas_NTUser] DEFAULT ([dbo].[sp_usuario](suser_sname())),
[FechaCarga] [datetime] NULL CONSTRAINT [DF_tb_Normativas_FechaCarga] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Normativas] ADD CONSTRAINT [PK_tb_Normativas] PRIMARY KEY CLUSTERED  ([IdNormativa]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_tb_Normativas] ON [dbo].[tb_Normativas] ([Anio], [Numero], [IdNormativaTipo]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Normativas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Normativas_tb_NormativasAmbito] FOREIGN KEY ([IdNormativaAmbito]) REFERENCES [dbo].[tb_NormativasAmbito] ([IdNormativaAmbito])
GO
ALTER TABLE [dbo].[tb_Normativas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Normativas_tb_TiposDeNormativa] FOREIGN KEY ([IdNormativaTipo]) REFERENCES [dbo].[tb_TiposDeNormativa] ([IdNormativaTipo])
GO
ALTER TABLE [dbo].[tb_Normativas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Normativas_tb_Organizaciones] FOREIGN KEY ([IdOrganizacionEmisora]) REFERENCES [dbo].[tb_Organizaciones] ([idOrganizaciones])
GO
ALTER TABLE [dbo].[tb_Normativas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Normativas_tb_SubOrganizaciones] FOREIGN KEY ([IdSubOrganizacionAutora]) REFERENCES [dbo].[tb_SubOrganizaciones] ([idSubOrganizacion])
GO
